<template>
  <div>
    <div class="panel_end clearfix">
      <el-button class="fr" type="primary" v-if="isShowCheck" @click="openCheck">审核</el-button>
    </div>
    <h3 class="panel-title">转正申请</h3>
    <div class="panel-main">

      <el-row class="el_row_bottom">
        <el-col :span="4" class="col_label">申请简述:</el-col>
        <el-col :span="20" class="col_view">{{form.description}}</el-col>
      </el-row>
    </div>
    <h3 class="panel-title">供应商基本信息</h3>
    <div class="panel-main">
      <el-row class="el_row_bottom">
        <el-col :span="4" class="col_label">企业全称:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.cmpFulName}}</el-col>
        <el-col :span="4" class="col_label">企业类型:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.attribute}}</el-col>
        <el-col :span="4" class="col_label">企业性质:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.cmpNature}}</el-col>
      </el-row>
      <el-row class="el_row_bottom">
        <el-col :span="4" class="col_label">成立年份:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.foundedYear}}</el-col>
        <el-col :span="4" class="col_label">注册资金(万元):</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.registeredAssets}}</el-col>
        <el-col :span="4" class="col_label">企业法人:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.corporation}}</el-col>
      </el-row>
      <el-row class="el_row_bottom">
        <el-col :span="4" class="col_label">注册地址:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.addressDetail}}</el-col>
        <el-col :span="4" class="col_label">邮编:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.postCode}}</el-col>
        <el-col :span="4" class="col_label">供货区域:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.supplyArea}}</el-col>
      </el-row>
      <el-row class="el_row_bottom">
        <el-col :span="4" class="col_label">公司地址:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.address}}</el-col>
        <el-col :span="4" class="col_label">主供品类:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.offeringName}}</el-col>
        <el-col :span="4" class="col_label">统一社会信用代码:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.socialCreditCode}}</el-col>
      </el-row>
      <el-row class="el_row_bottom">
        <el-col :span="4" class="col_label">扫描件上传:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.taxCodeFileName}}</el-col>
        <el-col :span="4" class="col_label">是否能出口:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.exitFlag}}</el-col>
        <el-col :span="4" class="col_label">出口许可证:</el-col>
        <el-col :span="4" class="col_view">{{vendorForm.exportFileName}}</el-col>
      </el-row>
    </div>
    <h3 class="panel-title">开发过程</h3>
    <div class="panel-main">
      <h2 class="panel-title panel-title-width">开发申请</h2>
      <el-table :data="dlvApplyData" border style="width: 100%">
        <el-table-column prop="purOrgName" label="采购组织">
        </el-table-column>
        <el-table-column prop="purGroupName" label="采购组">
        </el-table-column>
        <el-table-column prop="applyNo" label="申请号">
        </el-table-column>
        <el-table-column prop="title" label="申请主题">
        </el-table-column>
        <el-table-column prop="categoryName" label="品类">
        </el-table-column>
        <el-table-column prop="submitTime" label="发布日期">
        </el-table-column>
      </el-table>
      <!--  <h2 class="panel-title">样品</h2>
     <el-table :data="dataTable2" border style="width: 100%">
        <el-table-column  prop="vendorId" label="采购组织">
        </el-table-column>
        <el-table-column  prop="vendorId" label="采购组">
        </el-table-column>
        <el-table-column  prop="vendorId" label="单号">
        </el-table-column>
        <el-table-column  prop="vendorId" label="任务名称">
        </el-table-column>
        <el-table-column  prop="vendorId" label="打样类型">
        </el-table-column>
        <el-table-column  prop="vendorId" label="打样状态">
        </el-table-column>
        <el-table-column  prop="vendorId" label="发布日期">
        </el-table-column>
        <el-table-column  prop="vendorId" label="打样通过日期">
        </el-table-column>
      </el-table> -->
      <h2 class="panel-title panel-title-width">工厂验证</h2>
      <el-table :data="factoryInspectData" border style="width: 100%">
        <el-table-column prop="purOrgName" label="采购组织">
        </el-table-column>
        <el-table-column prop="purGroupName" label="采购组">
        </el-table-column>
        <el-table-column prop="inspectNo" label="单号">
        </el-table-column>
        <el-table-column prop="title" label="标题">
        </el-table-column>
        <el-table-column prop="inspectType" label="评估类型">
        </el-table-column>
        <!-- <el-table-column  prop="vendorId" label="评估岗位">
        </el-table-column> -->
        <el-table-column prop="TOTAL_POINTS" label="评估分数">
        </el-table-column>
        <el-table-column prop="checkStatus" label="评估结论">
        </el-table-column>
        <el-table-column prop="IMPROVE_FLAG" label="是否需整改">
        </el-table-column>
        <el-table-column prop="feedBackStatus" label="反馈状态">
        </el-table-column>
        <el-table-column prop="strCheckStatus" label="验证状态">
        </el-table-column>
        <el-table-column prop="publishTime" label="发布日期">
        </el-table-column>
      </el-table>
    </div>
    <h3 class="panel-title">审批日志</h3>
    <div class="panel-main">
      <el-table :data="checkLogData" border style="width: 100%">
        <el-table-column prop="createTime" label="审批时间">
        </el-table-column>
        <el-table-column prop="createUserId" label="审批人">
        </el-table-column>
        <el-table-column prop="checkStatus" label="审批结果">
        </el-table-column>
        <el-table-column prop="remarks" label="审批意见">
        </el-table-column>
      </el-table>
    </div>
    <el-dialog title="审核" :visible.sync="dialogTurnVisible" :close-on-click-modal="false" :show-close="false">
      <el-form :model="checkForm">
        <el-form-item label="供应商" :label-width="formLabelWidth">
          <el-select v-model="checkForm.checkStatus" placeholder="请选择">
            <el-option v-for="item in checkStatusData" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="restCheckForm">取 消</el-button>
        <el-button type="primary" @click="check">确 定</el-button>

      </div>
    </el-dialog>
  </div>


</template>

<script>
  import qs from 'qs';
  export default {

    data() {
      return {
        formLabelWidth: '120px',
        isShowCheck: false,
        dialogTurnVisible: false,
        checkStatusData: [{
            label: '通过',
            value: '1'
          },
          {
            label: '驳回',
            value: '-1'
          },
        ],
        form: {
          //prompt表
          description: ''
        },

        checkForm: {
          id: '',
          busCode: 'prompt',
          tableId: '',
          tableName: 'PROMPT',
          cateGoryCode: ''
        },
        vendorForm: {
          //vendorBaseInfo
        },
        dlvApplyData: [],
        dataTable2: [],
        factoryInspectData: [],
        checkLogData: [],
      };
    },
    mounted() {
      //优先判断是否拥有权限
      this.checkForm.cateGoryCode = this.$route.query.categoryCode;
      this.checkForm.tableId = this.$route.query.promptId
      this.axios.post(this.lib.config.host.vendorDlv + '/common/flowcheck/checkAuth', this.checkForm).then((res) => {
        this.isShowCheck = res.data.success;
        if (res.data.resultMap != null) {
          this.checkForm.id = res.data.resultMap.checkId;
        }


      })
      this.form.description = this.$route.query.description
      //获取转正申请信息
      // this.axios.post(this.lib.config.host.system + '/system/usermgt/users/saveOrUpdate').then((res)=>{

      // })
      //供应商基本信息
      this.axios.post(this.lib.config.host.vendorDlv + '/vendormgt/prompt/getVendorBaseInfo/' + this.$route.query.vendorId)
        .then((res) => {
          debugger;
          this.vendorForm = res.data;
          debugger;
        })
      //开发申请
      this.axios.post(this.lib.config.host.vendorDlv + '/vendormgt/dlv/dlvApply/findByApplyNo/' + this.$route.query.devApplyNo)
        .then((res) => {
          this.dlvApplyData.push(res.data);
        })
      //样品
      // this.axios.post(this.lib.config.host.system + '/system/usermgt/users/saveOrUpdate', this.form).then((res)=>{

      // })
      //工厂验证
      this.axios.post(this.lib.config.host.vendorDlv + '/vendormgt/dlv/factoryInspect/findByInspectNo/' + this.$route.query
        .devApplyNo).then((res) => {
        this.factoryInspectData.push(res.data);
      })
      //审批日志
      this.axios.post(this.lib.config.host.vendorDlv + '/common/flowcheck/getCheckLog', this.checkForm).then((res) => {
        this.checkLogData = res.data;
      })

    },
    methods: {
      restCheckForm() {
        this.dialogTurnVisible = false;
      },
      openCheck() {
        this.dialogTurnVisible = true;
      },
      check() {
        //审批日志      
        this.axios.post(this.lib.config.host.vendorDlv + '/common/flowcheck/check', qs.stringify(this.checkForm)).then(
          (res) => {
            debugger;
            if (res.data.success == true) {
              this.dialogTurnVisible = false;
              this.$router.push({
                path: '/Index/VendorDlv/VendorPrompt',

              })
            }
          })
      }
    }
  }

</script>
